<template>
    <view>
        <!--标题和返回-->
		<cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName">
			<block slot="backText">返回</block>
			<block slot="content">zc_compensation_grant_detail</block>
		</cu-custom>
		 <!--表单区域-->
		<view>
			<form>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发放ID：</text></view>
                  <input  placeholder="请输入发放ID" v-model="model.grantId"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发放人员ID：</text></view>
                  <input  placeholder="请输入发放人员ID" v-model="model.peopleId"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发放人员姓名：</text></view>
                  <input  placeholder="请输入发放人员姓名" v-model="model.peopleName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发放金额：</text></view>
                  <input type="number" placeholder="请输入发放金额" v-model="model.amt"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">备注：</text></view>
                  <input  placeholder="请输入备注" v-model="model.remark"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">身份证号码：</text></view>
                  <input  placeholder="请输入身份证号码" v-model="model.peopleIdCard"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">上级补偿项ID：</text></view>
                  <input  placeholder="请输入上级补偿项ID" v-model="model.superPayId"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">上级补偿项名称：</text></view>
                  <input  placeholder="请输入上级补偿项名称" v-model="model.superPayName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">项目ID：</text></view>
                  <input  placeholder="请输入项目ID" v-model="model.payId"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">项目付款名称：</text></view>
                  <input  placeholder="请输入项目付款名称" v-model="model.payName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">财评金额：</text></view>
                  <input type="number" placeholder="请输入财评金额" v-model="model.cpAmt"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发放金额：</text></view>
                  <input type="number" placeholder="请输入发放金额" v-model="model.payAmt"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">未发金额：</text></view>
                  <input type="number" placeholder="请输入未发金额" v-model="model.unPayAmt"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">单位：</text></view>
                  <input  placeholder="请输入单位" v-model="model.unit"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">disCount：</text></view>
                  <input type="number" placeholder="请输入disCount" v-model="model.disCount"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">quantity：</text></view>
                  <input type="number" placeholder="请输入quantity" v-model="model.quantity"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">unitPrice：</text></view>
                  <input type="number" placeholder="请输入unitPrice" v-model="model.unitPrice"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">财评ID：</text></view>
                  <input  placeholder="请输入财评ID" v-model="model.finEvalId"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">unPayQuantity：</text></view>
                  <input type="number" placeholder="请输入unPayQuantity" v-model="model.unPayQuantity"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">财评明细ID：</text></view>
                  <input  placeholder="请输入财评明细ID" v-model="model.finEvalDetailId"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">superPayCode：</text></view>
                  <input  placeholder="请输入superPayCode" v-model="model.superPayCode"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">payCode：</text></view>
                  <input  placeholder="请输入payCode" v-model="model.payCode"/>
                </view>
              </view>
				<view class="padding">
					<button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit">
						<text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交
					</button>
				</view>
			</form>
		</view>
    </view>
</template>

<script>
    import myDate from '@/components/my-componets/my-date.vue'

    export default {
        name: "ZcCompensationGrantDetailForm",
        components:{ myDate },
        props:{
          formData:{
              type:Object,
              default:()=>{},
              required:false
          }
        },
        data(){
            return {
				CustomBar: this.CustomBar,
				NavBarColor: this.NavBarColor,
				loading:false,
                model: {},
                backRouteName:'index',
                url: {
                  queryById: "/core/zcCompensationGrantDetail/queryById",
                  add: "/core/zcCompensationGrantDetail/add",
                  edit: "/core/zcCompensationGrantDetail/edit",
                },
            }
        },
        created(){
             this.initFormData();
        },
        methods:{
           initFormData(){
               if(this.formData){
                    let dataId = this.formData.dataId;
                    this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{
                        if(res.data.success){
                            console.log("表单数据",res);
                            this.model = res.data.result;
                        }
                    })
                }
            },
            onSubmit() {
                let myForm = {...this.model};
                this.loading = true;
                let url = myForm.id?this.url.edit:this.url.add;
				this.$http.post(url,myForm).then(res=>{
				   console.log("res",res)
				   this.loading = false
				   this.$Router.push({name:this.backRouteName})
				}).catch(()=>{
					this.loading = false
				});
            }
        }
    }
</script>
